/*
 * @Author: LiJia
 * @Date: 2021-02-27 10:27:15
 * @LastEditTime: 2021-02-27 10:48:56
 * @LastEditors: LiJia
 * @Description: Description
 * @FilePath: \test\src\mysql\connection.ts
 */
import mysql from 'mysql'
import mysqlConfig from './config'

const HOST = mysqlConfig.host
const USER = mysqlConfig.user
const PASSWORD = mysqlConfig.password
const DATABASE = mysqlConfig.database

const connection = mysql.createConnection({
  host: HOST,
  user: USER,
  password: PASSWORD,
  database: DATABASE
})

connection.connect()

// connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
//   if (error) throw error;
//   console.log('The solution is: ', results[0].solution);
// });

export default connection
